/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.hieu.sms.model;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * 
 * @author do_th
 */
@Entity
@Table(name = "course")
@NamedQueries({
		@NamedQuery(name = "Course.findAll", query = "SELECT c FROM Course c"),
		@NamedQuery(name = "Course.findById", query = "SELECT c FROM Course c WHERE c.id = :id"),
		@NamedQuery(name = "Course.findByCourseId", query = "SELECT c FROM Course c WHERE c.courseId = :courseId"),
		@NamedQuery(name = "Course.findByDepId", query = "SELECT c FROM Course c WHERE c.depId = :depId"),
		@NamedQuery(name = "Course.findByMajorId", query = "SELECT c FROM Course c WHERE c.majorId = :majorId"),
		@NamedQuery(name = "Course.findBySemester", query = "SELECT c FROM Course c WHERE c.semester = :semester"),
		@NamedQuery(name = "Course.findByIsrequired", query = "SELECT c FROM Course c WHERE c.isrequired = :isrequired"),
		@NamedQuery(name = "Course.findByName", query = "SELECT c FROM Course c WHERE c.name = :name"),
		@NamedQuery(name = "Course.findByTheoryUnit", query = "SELECT c FROM Course c WHERE c.theoryUnit = :theoryUnit"),
		@NamedQuery(name = "Course.findByPractiseUnit", query = "SELECT c FROM Course c WHERE c.practiseUnit = :practiseUnit"),
		@NamedQuery(name = "Course.findByIsMidTest", query = "SELECT c FROM Course c WHERE c.isMidTest = :isMidTest"),
		@NamedQuery(name = "Course.findByIsEssays", query = "SELECT c FROM Course c WHERE c.isEssays = :isEssays"),
		@NamedQuery(name = "Course.findByIsFinalTest", query = "SELECT c FROM Course c WHERE c.isFinalTest = :isFinalTest") })
public class Course extends AbstractPersistentEntity {
	private static final long serialVersionUID = 1L;
	@Id
	@Column(name = "id", updatable = false)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "CourseSequence")
	@SequenceGenerator(name = "CourseSequence", sequenceName = "seq_course", allocationSize = 1)
	private Long id;
	@Basic(optional = false)
	@Column(name = "course_id")
	private String courseId;
	@Basic(optional = false)
	@Column(name = "dep_id")
	private String depId;
	@Column(name = "major_id")
	private String majorId;
	@Column(name = "semester")
	private Integer semester;
	@Column(name = "isrequired")
	private Boolean isrequired;
	@Basic(optional = false)
	@Column(name = "name")
	private String name;
	@Column(name = "theory_unit")
	private Integer theoryUnit;
	@Column(name = "practise_unit")
	private Integer practiseUnit;
	@Column(name = "is_mid_test")
	private Boolean isMidTest;
	@Column(name = "is_essays")
	private Boolean isEssays;
	@Column(name = "is_final_test")
	private Boolean isFinalTest;

	public Course() {
	}

	public Course(Long id) {
		this.id = id;
	}

	public Course(Long id, String courseId, String depId, String name) {
		this.id = id;
		this.courseId = courseId;
		this.depId = depId;
		this.name = name;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getCourseId() {
		return courseId;
	}

	public void setCourseId(String courseId) {
		this.courseId = courseId;
	}

	public String getDepId() {
		return depId;
	}

	public void setDepId(String depId) {
		this.depId = depId;
	}

	public String getMajorId() {
		return majorId;
	}

	public void setMajorId(String majorId) {
		this.majorId = majorId;
	}

	public Integer getSemester() {
		return semester;
	}

	public void setSemester(Integer semester) {
		this.semester = semester;
	}

	public Boolean getIsrequired() {
		return isrequired;
	}

	public void setIsrequired(Boolean isrequired) {
		this.isrequired = isrequired;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getTheoryUnit() {
		return theoryUnit;
	}

	public void setTheoryUnit(Integer theoryUnit) {
		this.theoryUnit = theoryUnit;
	}

	public Integer getPractiseUnit() {
		return practiseUnit;
	}

	public void setPractiseUnit(Integer practiseUnit) {
		this.practiseUnit = practiseUnit;
	}

	public Boolean getIsMidTest() {
		return isMidTest;
	}

	public void setIsMidTest(Boolean isMidTest) {
		this.isMidTest = isMidTest;
	}

	public Boolean getIsEssays() {
		return isEssays;
	}

	public void setIsEssays(Boolean isEssays) {
		this.isEssays = isEssays;
	}

	public Boolean getIsFinalTest() {
		return isFinalTest;
	}

	public void setIsFinalTest(Boolean isFinalTest) {
		this.isFinalTest = isFinalTest;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (id != null ? id.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are
		// not set
		if (!(object instanceof Course)) {
			return false;
		}
		Course other = (Course) object;
		if ((this.id == null && other.id != null)
				|| (this.id != null && !this.id.equals(other.id))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "com.hieu.sms.model.Course[ id=" + id + " ]";
	}

}
